package com.ljx.javaredis.controller;

import com.ljx.javaredis.entiey.Dept;
import com.ljx.javaredis.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author LJX
 * @Description: TODO
 * @Date: 2022/12/7 15:58
 * @Version 1.0
 */
@RestController
@RequestMapping("dept")
public class DeptController {
	@Autowired
	private DeptService deptService;
	@GetMapping
	public Dept findById(int deptno) {
		return deptService.findById(deptno);
	}


	@PutMapping
	public int updateById(@RequestBody Dept dept) {
		return deptService.updateById(dept);
	}

	@PostMapping
	public int insetToDept(@RequestBody Dept dept) {
		// 向数据表中添加数据
		return deptService.insetToDept(dept);
	}

	@DeleteMapping
	public int deleteById(int deptno) {
		return deptService.deleteById(deptno);
	}
}
